package three;

public class phoneTest {
    public static void main(String[] args) {
        phone[] arr = new phone[3];
        phone p1 = new phone("OPPO", 6999, "黑色");
        phone p2 = new phone("小米", 999, "白色");
        phone p3 = new phone("华为", 9999, "绿色");

        arr[0] = p1;
        arr[1] = p2;
        arr[2] = p3;

        int sum = 0;
        for (int i = 0; i < arr.length; i++) {
            phone phone = arr[i];
            sum = sum + phone.getPrice();
        }
        double avg = sum * 1.0 / arr.length;
        System.out.println(avg);
    }

}
